<?PHP

	class tpl_events {
		
		public static function events(){
		
			$events = '';
			$class = 'td2';
			foreach($GLOBALS['OUTPUT']->events as $time=>$desc){
				$date = date($GLOBALS['OUTPUT']->settings['long_date_format'],$time);
				
				$events .= <<<EOV
<tr>
	<td class='$class'>$date</td>
	<td class='$class'>{$desc['description']}</td>
	<td class='$class'><a href='./index.php?act=admin&page=events&delete=$time{$GLOBALS['OUTPUT']->ses}'>[{$GLOBALS['LANG']->lang_admin->delete}]</a></td>
</tr>
EOV;
				$class = ($class == 'td2' ? 'td1' : 'td2');
			}
			
			if(empty($events)){
				$events = <<<EOV
<tr>
	<td class='td2' colspan='3' style='text-align: center; font-style: italic'>{$GLOBALS['LANG']->lang_admin->noevents}</td>
</tr>
EOV;
			}
			
			$page_data = '';
			for($curpage = 1; $curpage <= $GLOBALS['OUTPUT']->pages; $curpage++){
				$is_curpage = ($curpage == $GLOBALS['OUTPUT']->page ? ' selected="true"' : '');
				
				$page_data .= <<<EOV
<option $is_curpage onclick="document.location='./index.php?act=admin&&page=events{$GLOBALS['OUTPUT']->ses}&pager=$curpage'">$curpage</option>
EOV;
			}
			
			return	tpl_globals::header() .
				<<<EOV
<form action='./index.php?act=admin{$GLOBALS['OUTPUT']->ses}&page=events' method='post'>
	<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->events}</div>
	<table style='width: 100%;' cellspacing='1' cellpadding='5'>
		<tr>
			<td class='table_header_row' width='40%'>{$GLOBALS['LANG']->lang_admin->date}</td>
			<td class='table_header_row' width='40%'>{$GLOBALS['LANG']->lang_admin->event}</td>
			<td class='table_header_row' width='20%'>{$GLOBALS['LANG']->lang_admin->action}</td>
		</tr>
		{$events}
		<tr>
			<td class='table_header_row' width='100%' colspan='3'>{$GLOBALS['LANG']->lang_admin->page}: &nbsp;
				<select style='width: 60px;'>
					{$page_data}
				</select>
			</td>
		</tr>
	</table>
	
	<br />
	
	<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->addevent}</div>
	<table style='width: 100%;' cellspacing='1' cellpadding='5'>
		{$GLOBALS['OUTPUT']->form}
		<tr>
			<td class='table_header_row' colspan='2' style='text-align: center'><input class='form_button_norm' onmouseout="this.className=this.className.replace('_over','_norm');" onmouseover="this.className=this.className.replace('_norm','_over');" type='submit' value='{$GLOBALS['LANG']->lang_formcommon->submit}' /></td>
		</tr>
	</table>
</form>
EOV
.
			tpl_globals::footer();
				
		}
		
	}

?>